package com.itcam.iostream;

import java.io.*;

/**
 * Author:Cammy.Wu
 * Date:2024-05-14
 * Description:
 */

/**
 * seriaVersinUID
 *      凡是Serializable接口的类都有一个表示序列化版本标识符的静态变量
 *      即：private static final long seriaVersinUID = 123456L;
 *
 *  序列化细节：
 *      被序列化的类的内部的所有属性，必须是可序列化的（基本数据类型都是可序列化的）
 *      static、transient修饰的属性不可序列化
 */

public class SerializableStreamDemo02 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("E:\\IOstream\\SerializableStreamDemo.txt")));
        // 读入内存
        People people = (People) (ois.readObject());
        System.out.println("people = " + people.toString());
        // 关闭流
        ois.close();
    }
}
